<?php
 
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of AcawebUtils
 *
 * @author JeyDotC
 */
class AcawebUtils {

    /**
     *
     * @return PeriodoAcademico
     */
    public static function GetPeriodoAcademicoActual() {
        $config = self::GetConfig();
        return self::getPeriodoFromConfig($config->periodoActual);
    }

    /**
     *
     * @return PeriodoAcademico
     */
    public static function GetPeriodoAcademicoMatriculas() {
        $config = ModulesContext::instance()->getConfig();
        return self::getPeriodoFromConfig($config->periodoMatriculas);
    }

    /**
     *
     * @return Routing
     */
    public static function GetRouting() {
        return ModulesContext::instance()->getRouting();
    }

    /**
     *
     * @return PeriodoAcademico
     */
    private static function getPeriodoFromConfig(array $periodosParams) {
        Loader::using("models::entities::PeriodoAcademico");
        return PeriodoAcademico::newInstance($periodosParams["ano"], $periodosParams["periodo"]);
    }

    /**
     *
     * @return AppConfig
     */
    public static function GetConfig() {
        return ModulesContext::instance()->getConfig();
    }

    /**
     *
     * @return Principal
     */
    public static function GetUser() {
        return ModulesContext::instance()->getCurrentUser();
    }

}

?>
